public class MissingNumberSubmissions {
    // 丢失的数字 https://leetcode.cn/problems/missing-number/
    public int missingNumber(int[] nums) {
        int n=nums.length;
        int ans=0;
        for(int i=0;i<nums.length;i++) {
            ans^=nums[i];
        }
        for(int i=0;i<=n;i++) {
            ans^=i;
        }
        return ans;
    }

}
